package com.hdax.dmw.item.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hdax.dmw.dtos.item.IndexNavDto;
import com.hdax.dmw.entity.item.DmItemType;
import com.hdax.dmw.item.mapstructs.IndexNavDtoMapper;
import com.hdax.dmw.item.service.DmItemTypeService;
import com.hdax.dmw.item.mappers.DmItemTypeMapper;
import com.hdax.dmw.utils.Result;
import com.hdax.dmw.utils.ResultGenerator;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* @author guoyisha
* @description 针对表【dm_item_type(节目类型表)】的数据库操作Service实现
* @createDate 2023-06-15 08:59:12
*/
@Service
public class DmItemTypeServiceImpl extends ServiceImpl<DmItemTypeMapper, DmItemType>
    implements DmItemTypeService{

    @Autowired
    private IndexNavDtoMapper navDtoMapper;

    @Cacheable(value = "navs",keyGenerator = "ruleKeyGenerator")
    @Override
    public Result<List<IndexNavDto>> nav() {
        System.out.println("===========================");
        System.out.println("目标方法执行");
        System.out.println("===========================");
        List<DmItemType> dmItemTypes = baseMapper.selectAllLevelOne();
        List<IndexNavDto> targetList = navDtoMapper.toTargetList(dmItemTypes);
        return ResultGenerator.genSuccessResult(targetList);
    }
}




